﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/Layouts/Admin.Master" AutoEventWireup="true"
    CodeBehind="GroupManager.aspx.cs" Inherits="MLM.AdminCP.Pages.GroupManager" meta:resourcekey="PageResource1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Label ID="lbName" runat="server" Text="Group Management" 
        meta:resourcekey="lbNameResource1"></asp:Label>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
        AllowSorting="True" DataSourceID="GroupEds" GridLines="None" ShowGroupPanel="True"
         AllowAutomaticDeletes="True" 
        AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
        ShowFooter="True" ShowStatusBar="True" 
        meta:resourcekey="RadGrid1Resource1">
        <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True">
            <Selecting AllowRowSelect="True" />
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="RoleID" DataSourceID="GroupEds"
            ShowHeader="true" ShowHeadersWhenNoRecords="true" AllowAutomaticInserts="true"
            CommandItemDisplay="TopAndBottom">
            <CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="true"></CommandItemSettings>
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="RoleID" DataType="System.Int32" HeaderText="GroupID"
                    ReadOnly="True" SortExpression="RoleID" UniqueName="RoleID" 
                    meta:resourcekey="GridBoundColumnResource1">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name"
                    UniqueName="Name" meta:resourcekey="GridBoundColumnResource2">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ParentID" DataType="System.Int32" HeaderText="ParentID"
                    SortExpression="ParentID" UniqueName="ParentID" 
                    meta:resourcekey="GridBoundColumnResource3">
                </telerik:GridBoundColumn>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" 
                    UniqueName="EditCommandColumn" 
                    meta:resourcekey="GridEditCommandColumnResource1">
                    <ItemStyle CssClass="MyImageButton"></ItemStyle>
                </telerik:GridEditCommandColumn>
                <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                    UniqueName="DeleteColumn" meta:resourcekey="GridButtonColumnResource1">
                    <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                </telerik:GridButtonColumn>
            </Columns>
            <EditFormSettings EditFormType="Template">
                <EditColumn UniqueName="EditCommandColumn1">
                </EditColumn>
                <FormTemplate>
                    <table id="Table2" style="border-collapse: collapse; padding-left: 20">
                        <tr class="EditFormHeader" style="height: 30px">
                            <td style="font-size: small">
                                <b><asp:Label ID="Label1" runat="server" Text="Group Information" 
                                    meta:resourcekey="Label1Resource1"></asp:Label></b>
                            </td>
                        </tr>
                        <tr style="height: 30">
                            <td style="padding-left: 0px; padding-right: 10px; width: 80px">
                                <asp:Label ID="lbName" runat="server" Text="Name:" 
                                    meta:resourcekey="lbNameResource2"></asp:Label>
                            </td>
                            <td style="width: 50">
                                <telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Bind("Name") %>' 
                                    LabelCssClass="" meta:resourcekey="RadTextBox1Resource1">
                                </telerik:RadTextBox>
                                <asp:RequiredFieldValidator ID="TextBoxRequiredFieldValidator" runat="server" Display="Dynamic"
                                    ControlToValidate="RadTextBox1" 
                                    ErrorMessage="The textbox can not be empty!" 
                                    meta:resourcekey="TextBoxRequiredFieldValidatorResource1"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr style="height: 30px;">
                            <td>
                                <asp:Label ID="lbParentGroup" runat="server" Text="Parent Group:" 
                                    meta:resourcekey="lbParentGroupResource1"></asp:Label>
                            </td>
                            <td style="width: 30">
                                <telerik:RadComboBox CssClass="rancombox" runat="server" ID="RadComboBox1" DataTextField="Name"
                                    DataValueField="RoleID" DataSourceID="RoleEds" SelectedValue='<%# Bind("ParentID") %>'
                                    EnableLoadOnDemand="True" meta:resourcekey="RadComboBox1Resource1">
                                    <HeaderTemplate>
                                        <ul>
                                            <li style="list-style-type: none" class="col1">Parent Group</li>
                                        </ul>
                                    </HeaderTemplate>
                                </telerik:RadComboBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-bottom: 10px; padding-top: 10px">
                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" 
                                    CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' 
                                    meta:resourcekey="btnUpdateResource1">
                                </asp:Button>
                            </td>
                            <td style="padding-bottom: 10px; padding-top: 10px; margin-left: 20px">
                                <asp:Button ID="Button1" Text="Cancel" runat="server" CausesValidation="False" 
                                    CommandName="Cancel" meta:resourcekey="Button1Resource1">
                                </asp:Button>
                            </td>
                        </tr>
                    </table>
                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
        <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Office2007">
        </HeaderContextMenu>
    </telerik:RadGrid>
    <asp:EntityDataSource ID="GroupEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="Roles" 
        EntityTypeFilter="Role">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="RoleEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="Roles" 
        EntityTypeFilter="Role">
    </asp:EntityDataSource>
</asp:Content>
